package oxing.core;

public abstract class Scene extends MessagePool {
	Scene next;
	public final int width;
	public final int height;
	int background;
	Pixmap backgroundImage;

	protected Scene(int width, int height) {
		this(width, height, Screen.ORIENTATION_AUTO);
	}

	protected Scene(int width, int height, int orientation) {
		this.width = width;
		this.height = height;
		switch (orientation) {
		case Screen.ORIENTATION_AUTO:
			if (width > height)
				System.setScreenOrientation(Screen.ORIENTATION_LANDSCAPE);
			else if (height > width)
				System.setScreenOrientation(Screen.ORIENTATION_PORTRAIT);
			else
				System.setScreenOrientation(Screen.ORIENTATION_SENSOR);
			break;
		case Screen.ORIENTATION_PORTRAIT:
		case Screen.ORIENTATION_LANDSCAPE:
		case Screen.ORIENTATION_SENSOR:
			System.setScreenOrientation(orientation);
			break;
		default:
			System.setScreenOrientation(-1);
			break;
		}
		
	}

	protected final void setBackground(int color) {
		this.background = color;
	}

	protected final void setBackground(Pixmap pixmap) {
		this.background = 0;
		this.backgroundImage = pixmap;
	}

	public abstract void draw(Graphics g);

	protected void handleMessage(Message msg) {

	}
}
